﻿<!DOCTYPE>

<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=EDGE;IE=11;IE=8,chrome=1" />
    <title>批次工序排产信息</title>
    <link href="/InSiteWebApplication/Content/Easyui/themes/metro/easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/custom-easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/themes/icon.css" rel="stylesheet" />
   
</head>
<body>
    <div class="panelSection">    
        <div class="easyui-panel " title="批次排产信息" style="padding:3px;width: 100%" 
        data-options="closable:false,collapsible:true,minimizable:false,maximizable:false"> 
               <div style="margin: 3px 0px 3px 3px">
                    <table id="gdApsContainerInfo" class="easyui-datagrid" style="width: 100%; height: 100px"
                        data-options="rownumbers:true,pagination:false,striped:true,checkOnSelect:true,selectOnCheck:true,singleSelect:false,pageNumber:1,pageSize:5,pageList:[5,10,20]">
                    </table>  
               </div>
        </div>         
    </div> 
     <div class="panelSection">    
        <div class="easyui-panel " title="工序排产信息" style="padding:3px;width: 100%" 
        data-options="closable:false,collapsible:true,minimizable:false,maximizable:false"> 
            <div style="margin: 3px 0px 3px 3px">
                <div style ="float:left; width:100%">                    
                    <table id="gdApsStepInfo" class="easyui-datagrid" style="width: 100%; height: 350px"
                            data-options="rownumbers:true,pagination:false,striped:true,checkOnSelect:true,selectOnCheck:true,singleSelect:true,pageNumber:1,pageSize:5,pageList:[5,10,20]">
                        
                    </table>  
                </div>

                <div style ="clear:both" ></div>
            </div>             
        </div>
    </div>
</body>
</html>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/ReferenceJsLib.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/CustomCommon.js" type="text/javascript"></script>
<script type="text/javascript">
    /*
    创建人：zhangrj
    日期：2024-08-05
    描述：排产明细
    */
    var page = {
        parentID: '', //父窗体div
        returnData: null, //返回的消息
        editIndex: null, //easyUI单元格编辑
        endEditing: function (gridId) {
            if (page.editIndex == undefined) { return true }
            if ($('#' + gridId).datagrid('validateRow', page.editIndex)) {
                var ed = $('#' + gridId).datagrid('getEditor', { index: page.editIndex, field: 'RESOURCEID' });

                //				var productname = $(ed.target).combobox('getText');
                //				$('#'+gridId).datagrid('getRows')[editIndex]['productname'] = productname;

                $('#' + gridId).datagrid('endEdit', page.editIndex);
                page.editIndex = undefined;
                return true;
            } else {
                return false;
            }
        },
        param: null,
        rootPath: getRootPath(), //网站根路径
        ajaxUrl: getRootPath() + "/Ashx/ApsHandler/RbApsLimitedCapacityHandler.ashx",
        //初始化页面
        init: function () {
            page.bind();
            page.loadContainerAps();
        },
        //页面事件绑定
        bind: function () {
            $("#gdApsStepInfo").datagrid({
                columns: [[
		            { field: 'STEPNO', title: '工步号', width: 60 },
                    { field: 'STEPINFODESC', title: '工步名', width: 100 },
		            { field: 'RESOURCEDESC', title: '设备', width: 120 },
		            { field: 'QTY', title: '数量', width: 60 },
		            { field: 'PREPARECYCLE', title: '准备时间(分)', width: 80 },
		            { field: 'MAKECYCLE', title: '加工时间(分)', width: 80 },
		            { field: 'TRANSFERCYCLE', title: '转运时间(分)', width: 80 },
		            { field: 'SHIPCYCLE', title: '转工时间(时)', width: 80 },
		            { field: 'STARTTIME', title: '开始时间', width: 150, formatter: function (value, row, index) {
		                if (!isNullOrWhiteSpaceStr(value)) {
		                    return dayjs(value).format('YYYY-MM-DD HH:mm:ss');
		                }
		            } 
		            },
		            { field: 'ENDTIME', title: '结束时间', width: 150, formatter: function (value, row, index) {
		                if (!isNullOrWhiteSpaceStr(value)) {
		                    return dayjs(value).format('YYYY-MM-DD HH:mm:ss');
		                }
		            } 
		            },
		            { field: 'RESSTARTTIME', title: '设备开始时间', width: 150, formatter: function (value, row, index) {
		                if (!isNullOrWhiteSpaceStr(value)) {
		                    return dayjs(value).format('YYYY-MM-DD HH:mm:ss');
		                }
		            } 
		            },
		            { field: 'RESENDTIME', title: '设备结束时间', width: 150, formatter: function (value, row, index) {
		                if (!isNullOrWhiteSpaceStr(value)) {
		                    return dayjs(value).format('YYYY-MM-DD HH:mm:ss');
		                }
		            } 
		            }
                ]]
            });
            $("#gdApsContainerInfo").datagrid({
                columns: [[
                 { field: 'MFGORDERNAME', title: '订单号', width: 120 },
		         { field: 'CONTAINERNAME', title: '批次', width: 250 },
                 { field: 'QTY', title: '在制数', width: 60 },
                 { field: 'WORKFLOWINFO', title: '工艺信息', width: 180 },
                 { field: 'CONTAINERTYPENAME', title: '流水卡类型', width: 100 },
                 { field: 'MFGSTARTDATE', title: '订单开始日期', width: 150, formatter: function (value, row, index) {
                     if (!isNullOrWhiteSpaceStr(value)) {
                         return dayjs(value).format('YYYY-MM-DD HH:mm:ss');
                     }
                 } 
                 },
                 { field: 'MFGENDDDATE', title: '订单结束日期', width: 150, formatter: function (value, row, index) {
                     if (!isNullOrWhiteSpaceStr(value)) {
                         return dayjs(value).format('YYYY-MM-DD HH:mm:ss');
                     }
                 } 
                 }

	           ]]
            });
        },
        //加载批次的排产信息
        loadContainerAps: function () {
            page.param.action = "GetContainerApsData";
            page.post(page.ajaxUrl, page.param, true, function (result) {
                if (!result.Result) {
                    displayMessage(result.Message, false);
                    return;
                }
                $("#gdApsContainerInfo").datagrid('loadData', { rows: result.DBDataSet.dtContainer });
                $("#gdApsStepInfo").datagrid('loadData', { rows: result.DBDataSet.dtStepInfo });
            });
        },
        //清除方法，重要！！！
        reset: function (iscondition, isresult, isDetail) {
            clearMessage();
            if (iscondition) {

            }
            if (isresult) {
                clearEasyuiDataGrid("gdApsStepInfo", 1); //清空列表
            }
            if (isDetail) {
                //                $("#ddlWorkcenter").combobox('clear');//不生效
                //                $("#ddlTeam").combobox('clear');
                //                $("#ddlResource").combobox('clear');

                //$("#ddlWorkcenter").combobox('loadData',[]);
                //$("#ddlTeam").combobox('loadData',[]);
                $("#ddlWorkcenter").combobox('select', '');
                $("#ddlTeam").combobox('select', '');
                $("#ddlResource").combobox('loadData', []);
                $('#txtStartDate').datetimebox('clear');
                $('#txtEndDate').datetimebox('clear');
                clearEasyuiDataGrid("gdMakeEmployee", 1);
                clearEasyuiDataGrid("gdMakeEmployeeTime", 1);
            }
        },
        //post数据（路径，参数，是否异步，成功返回方法）
        post: function (url, param, async, callback) {
            $.ajax({
                type: "Post",
                url: url,
                data: param,
                cashe: false,
                async: async,
                dataType: "json",
                beforeSend: function () {
                    $.messager.progress({ text: '', msg: '处理中...' });
                },
                success: function (data) {
                    $.messager.progress('close');
                    callback(data);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    $.messager.progress('close');
                    displayMessage(XMLHttpRequest.responseText, false);
                    page.enableBtn();
                }
            });
        }
    }
    $(function () {
        page.parentID = getParam("parentDiv");
        page.param = parent.$("#" + page.parentID).dialog('options').popupData; 

        page.init();

    });
</script>
